const Crawler = require('../libs/crawler'),
      { crawler_cof } = require('../config/config');

Crawler({
    url: crawler_cof.url.main,
    callback(){
        const $ = window.$, 
              $item = $('.stu');

        // 声明存储学生信息的数组
        const data = [];

        $item.each((index, item) => {
            const $el = $(item);

            const dataItem = {
                sid: index + 1,
                studentImg: $el.find('.stu-img').prop('src'),
                studentName: $el.find('.stu-img').prop('alt'),
                intro: $el.find('.stu-main-cnt ').text().replace(/(\\n|\s)/g, ''),
                courseName: $el.find('.stu-main-tit').prop('title'),
                courseLink: $el.find('.stu-main-tit').prop('href'),
                studentImgKey: ''
            };

            data.push(dataItem);
        });

        return data;
    }
})